package com.example.spring.service.impl;

import com.example.spring.mapper.LibraryMapper;
import com.example.spring.pojo.Library;
import com.example.spring.service.LibraryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LibraryServiceImpl implements LibraryService {

    @Resource
    private LibraryMapper libraryMapper;

    @Override
    public List<Library> selectLibrary() {
        List<Library> libraryList = libraryMapper.selectLibrary();
        return libraryList;
    }

    @Override
    public Library getLibrary(Integer id) {
        return libraryMapper.getLibrary(id);
    }

    @Transactional
    @Override
    public Integer updateLibrary(String position, Integer id) {
        return libraryMapper.updateLibrary(position, id);
    }

    @Override
    public Integer addLibrary(Library library) {
        return libraryMapper.addLibrary(library);
    }

}
